import 'package:flutter/material.dart';
import 'package:flutter_create_framework/component/place.dart';
import 'package:flutter_create_framework/util/screen_util.dart';

class BasePanel extends StatelessWidget {
  int index;
  String name;
  String text;
  Function onTap;
  BasePanel({Key key,@required this.index,@required this.name,@required this.text,this.onTap}):super(key:key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        margin: index % 2 == 0
            ? EdgeInsets.only(left: Pxw(context, 24))
            : EdgeInsets.only(
          right: Pxw(context, 24),
        ),
        decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(8),
            boxShadow: [
              BoxShadow(
                  color: Color.fromARGB(5, 0, 0, 0),
                  offset: Offset(0, Pxh(context, 9)),
                  blurRadius: Pxw(context, 28),
                  spreadRadius: Pxw(context, 8)),
              BoxShadow(
                  color: Color.fromARGB(8, 0, 0, 0),
                  offset: Offset(0, Pxh(context, 6)),
                  blurRadius: Pxw(context, 16),
                  spreadRadius: Pxw(context, 0)),
              BoxShadow(
                  color: Color.fromARGB(12, 0, 0, 0),
                  offset: Offset(0, Pxh(context, 3)),
                  blurRadius: Pxw(context, 6),
                  spreadRadius: Pxw(context, -4)),
            ]),
        child: Padding(
          padding: EdgeInsets.symmetric(
              horizontal: Pxw(context, 13),
              vertical: Pxh(context, 11)),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Text(
                name,
                style: TextStyle(fontSize: Pxsp(context, 14)),
              ),
              Place(
                height: 18,
              ),
              Center(
                child: Text(
                  text == null
                      ? ''
                      : text,
                  style: TextStyle(fontSize: Pxsp(context, 12)),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}
